ssp <- c("SSP2","SSP3")
gcm <- c("hg2e","ge2m","ipsl","mes_","ne1m","nocc")
rcp <- c("RCP26","RCP85","nocc")
co2 <- c("co2","noco2","nocc")
num <- c("N1","N2","N3","N4","N5","N6","N7","N8","N9","N10","N11","N12","N13","N14","N15","N16","N17","N18","N19","N20","N21","N22","N23","N24","N25","N26","N27","N28","N29","N30")
SYN <- c("2010","2011","2012","2013","2014","2015","2016","2017","2018","2019","2020","2021","2022","2023","2024","2025","2026","2027","2028","2029","2030","2031","2032","2033","2034","2035","2036","2037","2038","2039","2040","2041","2042","2043","2044","2045","2046","2047","2048","2049","2050","2051","2052","2053","2054","2055","2056","2057","2058","2059","2060")
year <- c("2020","2030","2040","2050")

x1 <- 0
x2 <- 0
x3 <- 0
x4 <- 0
for (i1 in 1:length(ssp)){
  for (i2 in 1:length(gcm)){
    for (i3 in 1:length(rcp)){
      for (i4 in 1:length(co2)){
        for (i5 in 1:length(SYN)){
          for (i6 in 1:length(num)){
            y1 <- c(year[1],ssp[i1],gcm[i2],rcp[i3],co2[i4],SYN[i5],num[i6])            
            y2 <- c(year[2],ssp[i1],gcm[i2],rcp[i3],co2[i4],SYN[i5],num[i6])            
            y3 <- c(year[3],ssp[i1],gcm[i2],rcp[i3],co2[i4],SYN[i5],num[i6])            
            y4 <- c(year[4],ssp[i1],gcm[i2],rcp[i3],co2[i4],SYN[i5],num[i6])  
            if(length(x1)==0){
              x1 <- y1  
              x2 <- y2  
              x3 <- y3  
              x4 <- y4  
            }else{
              x1 <- rbind(x1,y1)
              x2 <- rbind(x2,y2)
              x3 <- rbind(x3,y3)
              x4 <- rbind(x4,y4)
            }
          }
        }
      }
    }
  }
}

write.csv(x1, "2020.csv", quote=FALSE, row.names=FALSE)
write.csv(x2, "2030.csv", quote=FALSE, row.names=FALSE)
write.csv(x3, "2040.csv", quote=FALSE, row.names=FALSE)
write.csv(x4, "2050.csv", quote=FALSE, row.names=FALSE)


